package com.kedll.library.widget;

import android.content.Context;
import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet;

import com.kedll.library.R;
import com.kedll.library.listener.OnItemChangedListener;


/**
 * TODO: document your custom view class.
 */
public class TabBarTextView extends AppCompatTextView implements OnItemChangedListener {

    private static final int[] selectableState;
    private boolean selectable = false;

    static
    {
        int[] arrayOfInt1 = new int[1];
        arrayOfInt1[0] = R.attr.state_selectable;
        selectableState = arrayOfInt1;
    }

    public TabBarTextView(Context context) {
        super(context);
    }

    public TabBarTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public TabBarTextView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    protected int[] onCreateDrawableState(int extraSpace) {
        // TODO 自动生成的方法存根
        int[] state =  super.onCreateDrawableState(extraSpace + 5);
        if(selectable)
        {
            mergeDrawableStates(state, selectableState);
        }
        return state;
    }
    @Override
    public void setSelectable(boolean paramBoolean)
    {
        this.selectable = paramBoolean;
        refreshDrawableState();
    }


}
